package cn.wei.sdd.core.controller.wx;


import cn.wei.common.result.R;
import cn.wei.sdd.base.util.JwtUtils;
import cn.wei.sdd.core.pojo.vo.CheckOrdersVO;
import cn.wei.sdd.core.service.CheckRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * <p>
 * 验收记录表 前端控制器
 * </p>
 *
 * @author Wei
 * @since 2021-11-03
 */
@RestController
@Api(tags = "验收管理")
@RequestMapping("/wxApi/core/checkRecord")
public class CheckRecordController {

    @Resource
    private CheckRecordService checkRecordService;

    @ApiOperation("获取待验收的订单")
    @GetMapping("getCheckOrders/{status}")
    public R getCheckOrders(
            @PathVariable("status") Integer status,
            HttpServletRequest request){
        String token = request.getHeader("token");
        Long userId = JwtUtils.getUserId(token);

        List<CheckOrdersVO> list= checkRecordService.getCheckOrdersByUserId(userId,status);
        return R.ok().data("list",list);
    }


}

